<?php
class stFlickrToolboxHook extends sthook_2_1 {

    public function hookCustom() {        
        $method = array($this, 'showstFlickrToolbox');
        add_shortcode('ShowstFlickrToolbox', $method);

        $method = array($this, 'uploadRedirect');
        add_action('init', $method);
        
//        $method = array($this, 'sample');
//        add_action('init', $method);

//        $method = array($this, 'sample');
//        add_filter('init', $method);

    }
    
    public function includeExtraPlugin() {
        // default process here        
    }

    //Initialize hook function
    
    /**
     * Sample short code
     *
     * Create a short code to show stFlickrToolbox every where
     *
     * @since Plugin expert 1.0
     */
    function showstFlickrToolbox($args) {
        $args = shortcode_atts(array(
            'stFlickrToolbox_id' => '0'
            ), $args);

        $controllerName = $this->config['plugin_name'] . "Controller";
        $controllerObject = new $controllerName($this->config);
        return $controllerObject->getAction('showstFlickrToolbox', $args);
    }

    function uploadRedirect($args) {
        if(!empty($_REQUEST['frob'])){
            $stFlickrToolboxFunctions = new stFlickrToolboxFunctions($this->config);
            $stFlickrToolboxFunctions->flickrSaveToken($_REQUEST['frob']);
            echo '<script type="text/javascript">';
            echo "window.location = '" . admin_url('/admin.php?page=' . $this->config['plugin_name'] . '&action=flickrSetting') . "';";
            //echo "stcustom.stRedirect('" . admin_url('/admin.php?page=' . $this->config['plugin_name'] . '&action=flickrSetting') . "');";
            echo '</script>';

        }
    }
}
?>